<?php 
$data['page_selected'] = 'query';
$this->load->view('constants/header', $data);?>

<script type="text/javascript">
$(function() {
	var availableTags = new Array();
	<?php for($i=0; $i <  count($clubs) ; $i++){?>
		availableTags[<?php echo($i); ?>] = {label: "<?php echo($clubs[$i]['nombre']);?>",
											 value: "<?php echo($clubs[$i]['id_club']);?>"};
	<?php } ?>	
	
	$('#tags').autocomplete({
		minLength: 2,
		source: availableTags,
		focus: function(event, ui) {
			$('#tags').val(ui.item.label);
			return false;
		},
		select: function(event, ui) {
			$('#tags').val(ui.item.label);
			$('#club').val(ui.item.value);				
			return false;
		}
	});
});
</script>

<div id="site_content">
	<?php $this->load->view('constants/sidebar'); ?> 
    <div id="content">
        <!-- insert the page content here -->
	    <?php $this->load->view('query/menu'); ?>
        <br /><br /><br /><br />
  		<h3 align="center">Club</h3>  
        <h1>Actividades de un club</h1>      
        <table width="100%">
        	<tr>
             	<td align="center">
                    <form method="post" action="<?php echo base_url(); ?>query/get_club">
                        Buscar&nbsp;
                        <input id="tags" /> <input type="hidden" name="club" id="club"/>
                        &nbsp;
                        <input type="image" alt="Submit" src="<?php echo base_url().IMG; ?>search_2.png" width="20px" height="20px" title="Buscar">
                    </form>
		        </td>
        	</tr>
        </table>
        
        <?php if(isset($activities)){ ?>
            Club: <?php echo $club['nombre']; ?><br /><br />

            <?php if(count($activities) == 0) {?>
                        El club no posee actividades registradas.
            <?php } 
            else{?>
                <table width="100%">
                    <thead>
                        <th align="center"> Buddy </td>
                        <th align="center"> Buddy Univ./Col.</td>
                        <th align="center"> &#191Contacto Semanal? <br /> &#191Por qu&eacute; medio?</td>
                        <th align="center"> &#191Actividades junt@s? <br /> &#191D&oacute;nde y cu&aacute;ndo?</td>
                        <th align="center"> Observaciones</td>
                    </thead>
                    <?php foreach($activities as $r){ ?>
                        <tr>
                            <td width="10.2%" align="center" class="tdBorder">
                            	<a href="<?php echo base_url(); ?>query/get_user/<?php echo $r['BUDDY']['id_integrante']; ?>">
                                	<?php echo $r['BUDDY']['nombre'].' '.$r['BUDDY']['apellido']; ?>
                                </a>
                            </td>
                            <td width="10.2%" align="center" class="tdBorder">
                            	<a href="<?php echo base_url(); ?>query/get_user/<?php echo $r['id_integrante']; ?>">
                                	<?php echo $r['nombre'].' '.$r['apellido']; ?>
                                </a>
                            </td>
                            <td width="15%" align="center" class="tdBorder">
                                <?php echo $r['medio_actividad']; ?>
                            </td>
                            <td width="19%" class="tdBorder">
                                Lugar: <?php echo $r['lugar_actividad']; ?><br />
                                Durante la semana del: <?php echo format_date($r['fecha_inicio_de_semana']); ?>
                            </td>
                            <td width="25.2%" class="tdBorder">
                                <?php echo $r['descripcion_actividad']; ?>
                            </td>
                        </tr>
                    <?php } ?>
                </table>
            <?php } 
		}?> 
    </div>
</div>
<?php $this->load->view('constants/footer'); ?>